package com.msy.mai.framework.social.core.enums;

import com.msy.mai.common.core.utils.StringUtils;
import lombok.AllArgsConstructor;
import lombok.Getter;

/**
 * @author Wang
 * @version 1.0
 * @Date 2024/10/21 下午10:47
 * @description 第三方认证源
 */
@AllArgsConstructor
@Getter
public enum AuthSource {


    GITHUB("github"),

    GITEE("gitee"),

    WECHAT_OPEN("wechat_open"),

    WECHAT_MP("wechat_mp"),

    MAXKEY("maxkey"),
    ;


    private final String source;

    public static AuthSource of(String source) {
        if (StringUtils.isBlank(source)) {
            throw new IllegalArgumentException("Invalid AuthSource: " + source);
        }
        for (AuthSource value : AuthSource.values()) {
            if (value.getSource().equals(source)) {
                return value;
            }
        }
        throw new IllegalArgumentException("Invalid AuthSource: " + source);
    }

}
